// 各页面以组件形式 以组件活跃标识标记
export default {
  components: {
  },
  data() {
    return {
      active: {}, // 当前选中
      employeeTypes: [{
        title: '新员工',
        key: 'newEmployee',
        width: '180rpx',
        height: '180rpx',
        value: 0,
        activeImg: 'https://talentsupload.oss-cn-beijing.aliyuncs.com/miniprogram/quizzes/newEmployeeActive.png',
        inactiveImg: 'https://talentsupload.oss-cn-beijing.aliyuncs.com/miniprogram/quizzes/newEmployeeNormal.png'
      },{
        title: '老员工',
        key: 'oldEmployee',
        width: '136rpx',
        height: '180rpx',
        value: 1,
        activeImg: 'https://talentsupload.oss-cn-beijing.aliyuncs.com/miniprogram/quizzes/oldEmployeeActive.png',
        inactiveImg: 'https://talentsupload.oss-cn-beijing.aliyuncs.com/miniprogram/quizzes/oldEmployeeNormal.png'
      },]
    }
  },
  computed: {
    // 答题人信息
    answererInfo() {
      return this.$store.state.answererInfo;
    }
  },
  methods: {
    handleItem(e) {
      const { item } = e.currentTarget.dataset;
      if (this.active.key == item.key) {
        this.active = {};
        return
      }
      this.active = item;
    },
    // 下一步
    handleNext() {
      if (!Object.keys(this.active).length) {
        return uni.showToast({ title: '请选择新员工或者老员工', icon: 'none' })
      }
      this.$store.commit('setStore', {
        answererInfo: {
          newOrOld: this.active.value
        }
      })
      // 点击下一步 切换为填写基本数据
      this.$parent.active = this.$parent.activeEnum.basicInfo;
    }
  }
}